<template>
  <div class="app-container">
    <el-divider content-position="left">库存信息</el-divider>
    <el-descriptions border >
      <el-descriptions-item label="产品名称">{{ inventoryForm.productName }}</el-descriptions-item>
      <el-descriptions-item label="产品型号">
        <el-tag type="danger">{{ inventoryForm.productModel }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="产品单位">
        <el-tag  type="success"> {{inventoryForm.productUnit}}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="当前库存数量" >
        <el-tag  type="success"> {{inventoryForm.currentStock}} {{inventoryForm.productUnit}}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item >
        <template slot="label">
          <el-tooltip placement="top">
            <div slot="content">采购总额=所有入库登记的金额总和</div>
            <i class="el-icon-question"></i>
          </el-tooltip>
          采购总额
        </template>

        <el-tag type="danger">{{ inventoryForm.purchaseTotal }} 元</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="入库时间" >
        <span>{{ parseTime(inventoryForm.createTime) }}</span>
      </el-descriptions-item>
      <el-descriptions-item label="创建人/更新人" >{{inventoryForm.createBy}} / {{inventoryForm.updateBy}}</el-descriptions-item>
      <el-descriptions-item label="创建/更新时间" >{{inventoryForm.createTime }} / {{inventoryForm.updateTime }}</el-descriptions-item>
      <el-descriptions-item label="备注" >{{inventoryForm.remark}}</el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">出入库记录</el-divider>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
      <el-form-item label="出入库存" prop="changeType">
        <el-select v-model="queryParams.changeType" placeholder="请选择出库或入库" clearable @change="handleQuery">
          <el-option
            v-for="dict in dict.type.bus_change_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="入库类型" prop="stockType">
        <el-select v-model="queryParams.stockType" placeholder="请选择入库类型" clearable @change="handleQuery">
          <el-option value="">全部</el-option>
          <el-option
            v-for="dict in dict.type.bus_stock_type_in"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="出库类型" prop="stockType">
        <el-select v-model="queryParams.stockType" placeholder="请选择出库类型" clearable @change="handleQuery">
          <el-option
            v-for="dict in dict.type.bus_stock_type_out"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="出入库日期">
        <el-date-picker
          v-model="daterangeTransactionDate"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          @change="handleQuery"
        ></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd('IN')"
          v-hasPermi="['inventory:history:add']"
        >新增入库</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd('OUT')"
          v-hasPermi="['inventory:history:add']"
        >新增出库</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['inventory:history:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['inventory:history:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="historyList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" type="index" />
      <el-table-column label="出入库说明" align="center" prop="explanation" width="260"/>
      <el-table-column label="出入库类型" align="center" prop="changeType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.bus_change_type" :value="scope.row.changeType"/>
        </template>
      </el-table-column>
      <el-table-column label="库存标签" align="center" prop="stockType">
        <template slot-scope="scope" >
          <dict-tag v-if="scope.row.changeType === 'IN'" :options="dict.type.bus_stock_type_in" :value="scope.row.stockType"/>
          <dict-tag v-if="scope.row.changeType === 'OUT'" :options="dict.type.bus_stock_type_out" :value="scope.row.stockType"/>
        </template>
      </el-table-column>
      <el-table-column label="更新前数量" align="center" prop="beforeQuantity" />
      <el-table-column label="库存变化" align="center" prop="quantity" >
        <template slot-scope="scope">
          <el-tag v-if="scope.row.changeType === 'IN'" type="success">入库： {{ scope.row.quantity }} </el-tag>
          <el-tag v-if="scope.row.changeType === 'OUT'" type="danger">出库： {{ scope.row.quantity }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="更新后数量" align="center" prop="afterQuantity" />
      <el-table-column label="金额" align="center" prop="amount" >
        <template slot-scope="scope">
          <el-tag type="danger"> {{ scope.row.amount }} 元</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="出入库日期" align="center" prop="transactionDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.transactionDate, '{y}-{m}-{d} ') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建人/创建时间" align="center" prop="" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.createBy }}/</span>
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-info"
            @click="handleInfo(scope.row)"
            v-hasPermi="['inventory:history:query']"
          >查看</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['inventory:history:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改出入库记录对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body :close-on-click-modal="false">
      <el-divider content-position="left">库存信息</el-divider>
      <el-descriptions border >
        <el-descriptions-item label="产品名称">{{ inventoryForm.productName }}</el-descriptions-item>
        <el-descriptions-item label="产品型号">
          <el-tag type="success"> {{ inventoryForm.productModel  }} </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="当前库存数量" >
          <el-tag type="success"> {{inventoryForm.currentStock}}  {{inventoryForm.productUnit}} </el-tag>
        </el-descriptions-item>
        <el-descriptions-item >
          <template slot="label">
            <el-tooltip placement="top">
              <div slot="content">采购总额=所有入库登记的金额总和</div>
              <i class="el-icon-question"></i>
            </el-tooltip>
            采购总额
          </template>
          <el-tag type="success"> {{inventoryForm.purchaseTotal}} 元 </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="入库时间" >
          <span>{{ parseTime(inventoryForm.createTime) }}</span>
        </el-descriptions-item>
        <el-descriptions-item label="备注" :span="3">{{inventoryForm.remark}}</el-descriptions-item>

      </el-descriptions>
      <el-divider content-position="left">{{form.changeType === 'IN'?'入库信息':'出库信息'}}</el-divider>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item :label="form.changeType === 'IN'?'入库说明':(form.changeType === 'OUT'?'出库说明':'出入库说明')" prop="explanation">
              <el-input v-model="form.explanation" :rows="3" type="textarea" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item :label="form.changeType === 'IN'?'入库前数量':'出库前数量'" prop="beforeQuantity">
              <el-input v-model="form.beforeQuantity" placeholder="请输入更新前数量" :disabled="true"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="form.changeType === 'IN'?'入库后数量':'出库后数量' " prop="afterQuantity">
              <el-input v-model="form.afterQuantity" placeholder="请输入更新后数量" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.changeType != null">
            <el-form-item :label="form.changeType === 'IN'?'入库数量':(form.changeType === 'OUT'?'出库数量':'出入数量')" prop="quantity">
              <el-input-number v-if="form.changeType === 'IN'" v-model="form.quantity" placeholder="请输入库存变化" :min="1" @change="handleAfterQuantity"/>
              <el-input-number v-if="form.changeType === 'OUT'" v-model="form.quantity" placeholder="请输入库存变化" :max="-1" @change="handleAfterQuantity"/>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.changeType != null">
            <el-form-item :label="form.changeType === 'IN'?'入库标签':(form.changeType === 'OUT'?'出库标签':'出入库标签')" prop="stockType" >
              <el-select v-model="form.stockType" placeholder="请选择库存标签">
                <el-option v-if="form.changeType === 'IN'"
                           v-for="dict in dict.type.bus_stock_type_in"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
                <el-option v-if="form.changeType === 'OUT'"
                           v-for="dict in dict.type.bus_stock_type_out"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.changeType === 'IN'">
            <el-form-item label="入库金额" prop="amount">
              <el-input-number v-model="form.amount" placeholder="请输入金额" :min="0" :precision="2" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item :label="form.changeType === 'IN'?'入库日期':'出库日期'" prop="transactionDate">
              <el-date-picker clearable
                              v-model="form.transactionDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择出入库日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="图片附件" prop="images">
              <image-upload v-model="form.images"/>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="其他附件" prop="files">
              <file-upload v-model="form.files"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 查看出入库记录对话框 -->
    <el-dialog :title="title" :visible.sync="openInfo" width="70%" append-to-body :close-on-click-modal="false">
      <el-divider content-position="left">库存信息</el-divider>
      <el-descriptions border >
        <el-descriptions-item label="产品名称">{{ inventoryForm.productName }}</el-descriptions-item>
        <el-descriptions-item label="产品型号">
          <el-tag type="success"> {{ inventoryForm.productModel  }} </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="当前库存数量" >
          <el-tag type="success"> {{inventoryForm.currentStock}}  {{inventoryForm.productUnit}} </el-tag>
        </el-descriptions-item>
        <el-descriptions-item >
          <template slot="label">
            <el-tooltip placement="top">
              <div slot="content">采购总额=所有入库登记的金额总和</div>
              <i class="el-icon-question"></i>
            </el-tooltip>
            采购总额
          </template>
          <el-tag type="success"> {{inventoryForm.purchaseTotal}} 元 </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="入库时间" >
          <span>{{ parseTime(inventoryForm.createTime) }}</span>
        </el-descriptions-item>
        <el-descriptions-item label="备注" :span="3">{{inventoryForm.remark}}</el-descriptions-item>

      </el-descriptions>

      <el-divider content-position="left">{{form.changeType === 'IN'?'入库信息':'出库信息'}}</el-divider>
      <el-descriptions border >
        <el-descriptions-item :label="form.changeType === 'IN'?'入库说明':(form.changeType === 'OUT'?'出库说明':'出入库说明')">{{ form.explanation }}</el-descriptions-item>
        <el-descriptions-item label="备注">
          {{ form.remark }}
        </el-descriptions-item>
        <el-descriptions-item :label="form.changeType === 'IN'?'入库前数量':'出库前数量'" >
          <el-tag type="success"> {{form.beforeQuantity}} </el-tag>
        </el-descriptions-item>

        <el-descriptions-item :label="form.changeType === 'IN'?'入库后数量':'出库后数量' " >
          <el-tag type="success"> {{form.afterQuantity}} </el-tag>
        </el-descriptions-item>
        <el-descriptions-item :label="form.changeType === 'IN'?'入库数量':(form.changeType === 'OUT'?'出库数量':'出入数量')" >
          {{form.quantity}} {{inventoryForm.productUnit}}</el-descriptions-item>
        <el-descriptions-item :label="form.changeType === 'IN'?'入库标签':(form.changeType === 'OUT'?'出库标签':'出入库标签')"  >
          <el-tag type="success"> {{form.stockType}} </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="入库金额" v-if="form.changeType === 'IN'" >
          <el-tag type="success"> {{form.amount}} 元</el-tag>
        </el-descriptions-item>
        <el-descriptions-item :label="form.changeType === 'IN'?'入库日期':'出库日期'" v-if="form.changeType === 'IN'" >
          {{form.transactionDate}}
        </el-descriptions-item>
        <el-descriptions-item label="创建人" >
          {{form.createBy}}
        </el-descriptions-item>
        <el-descriptions-item label="创建时间" >
          {{form.createTime}}
        </el-descriptions-item>

      </el-descriptions>

      <el-row >
        <el-col :span="24">
          <el-divider content-position="left">照片附件</el-divider>
          <template v-for="i in images">
            <image-preview  :src="i" :width="120" :height="120"/>
          </template>
        </el-col>
        <el-col :span="24">
          <el-divider content-position="left">其他附件</el-divider>
          <file-preview  v-model="form.files"/>
        </el-col>
      </el-row>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listHistory, getHistory, delHistory, addHistory } from "@/api/inventory/history";
import {getInventory, listInventory} from "@/api/inventory/inventory";

export default {
  name: "History",
  dicts: ['bus_stock_type_in','bus_stock_type_out', 'bus_change_type','bus_product_unit'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 出入库记录表格数据
      historyList: [],
      inventoryList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      openInfo: false,
      images: [],
      // 删除标志时间范围
      daterangeTransactionDate: [],
      // 库存ID
      inventoryId:null,
      // 库存信息
      inventoryForm : {},
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        inventoryId: null,
        recordId: null,
        stockType: '',
        changeType: '',
        quantity: null,
        beforeQuantity: null,
        afterQuantity: null,
        amount: null,
        explanation: null,
        transactionDate: null,
        images: null,
        files: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        transactionDate: [
          { required: true, message: "出入库日期不能为空", trigger: "blur" }
        ],
        explanation: [
          { required: true, message: "出入库说明不能为空", trigger: "blur" }
        ],
        quantity: [
          { required: true, message: "出入库存变化不能为0", trigger: "blur" },
          { validator: this.validateQuantity, trigger: "blur" }
        ],
        changeType: [
          { required: true, message: "出入库类型必选一个", trigger: "blur" }
        ],
        amount: [
          { required: true, message: "金额不能为0", trigger: "blur" },
          { validator: this.validateAmount, trigger: "blur" }
        ]
      }
    };
  },
  created() {
    const inventoryId = this.$route.params && this.$route.params.inventoryId;
    if(inventoryId != undefined){
      this.inventoryId = inventoryId;
      this.queryParams.inventoryId = inventoryId;
      this.getInventoryForm(inventoryId);

    }
    this.getInventoryList();
    this.getList();
    this.resetInventoryForm();

  },
  methods: {
    // 查看库存列表
    getInventoryList(){
      listInventory(this.queryParams).then(response => {
        this.inventoryList = response.rows;
      });
    },
    // 查询库存信息
    getInventoryForm(id){
      this.resetInventoryForm();
      const inventoryId = id
      getInventory(inventoryId).then(response => {
        this.inventoryForm = response.data;
      });
    },
    /** 查询出入库记录列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};

      if (null != this.daterangeTransactionDate && '' != this.daterangeTransactionDate) {
        this.queryParams.params["beginTransactionDate"] = this.daterangeTransactionDate[0];
        this.queryParams.params["endTransactionDate"] = this.daterangeTransactionDate[1];
      }
      listHistory(this.queryParams).then(response => {
        this.historyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.openInfo = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        historyId: null,
        inventoryId: null,
        recordId: null,
        stockType: null,
        changeType: null,
        quantity: 0,
        beforeQuantity: 0,
        afterQuantity: 0,
        amount: 0,
        explanation: null,
        transactionDate: null,
        images: null,
        files: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        delFlag: null
      };
      this.resetForm("form");
    },
    resetInventoryForm() {
      this.inventoryForm = {
        inventoryId: null,
        productId: null,
        productName: null,
        productModel: null,
        productUnit: null,
        currentStock: 0,
        purchaseTotal: 0,
        stockType: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        delFlag: null
      };
      this.resetForm("inventoryForm");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeTransactionDate = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.historyId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd(type) {
      this.reset();
      // 初始化值
      this.form.inventoryId = this.inventoryId;
      this.form.beforeQuantity = this.inventoryForm.currentStock;
      this.form.changeType = type;
      this.open = true;
      this.title = type === 'IN'?'添加入库记录':'添加出库记录';
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const historyId = row.historyId || this.ids
      getHistory(historyId).then(response => {
        this.form = response.data;
        this.form.inventoryId = this.inventoryId;
        this.form.beforeQuantity = this.inventoryForm.currentStock;
        this.open = true;
        this.title = "修改出入库记录";
      });
    },
    /** 查看按钮操作 */
    handleInfo(row) {
      this.reset();
      const historyId = row.historyId || this.ids
      this.getInventoryForm(row.inventoryId);
      getHistory(historyId).then(response => {
        this.form = response.data;
        this.images =  response.data.images.split(",");

        this.openInfo = true;
        this.title = "查看出入库记录";
      });
    },
    /** 提交按钮 */
    submitForm() {
      // 计算使入库为正的，出库为负的

      this.handleAfterQuantity();
      this.$refs["form"].validate(valid => {
        if (valid) {
          // 新增库存记录无法修改
          this.$modal.confirm('是否确认新增出入库记录为"' + this.form.explanation + '"的数据项？新增后无法修改！').then(function() {
            return 1;
          }).then(() => {
            addHistory(this.form).then(response => {
              this.open = false;
              this.getList();
              this.getInventoryForm(this.form.inventoryId);
              this.$modal.msgSuccess("新增成功");
            });
          }).catch(() => {});

        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const historyIds = row.historyId || this.ids;
      let afterQuantity = 0;
      // 原库存
      if(row.changeType === 'IN'){
        afterQuantity = this.inventoryForm.currentStock - row.quantity;
      }
      if(row.changeType === 'OUT'){
        afterQuantity = this.inventoryForm.currentStock + (-row.quantity);
      }

      this.$modal.confirm('现有库存数量：'+this.inventoryForm.currentStock+'，删除调整后库存：'+afterQuantity+' .是否确认删除出入库记录为"' + row.explanation + '"的数据项？"').then(function() {
        return delHistory(historyIds);
      }).then(() => {
        this.getList();
        this.getInventoryForm(this.inventoryId);
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('inventory/history/export', {
        ...this.queryParams
      }, `${this.inventoryForm.productName}_${this.inventoryForm.productModel}_出入库记录_${new Date().getTime()}.xlsx`)
    },
    /** 及时更新数量变化*/
    handleAfterQuantity(){
      this.form.afterQuantity = this.inventoryForm.currentStock + this.form.quantity;
    },
    validateQuantity(rule, value, callback) {
      if (this.form.changeType === 'IN' && value < 0) {
        callback(new Error("入库不能少于0"));
      }if (this.form.changeType === 'OUT' &&  this.inventoryForm.currentStock == 0 && value <= 0) {
        callback(new Error("当前库存数量为：0，不能添加出库记录"));
      } if (this.form.changeType === 'OUT' &&  value > 0) {
        callback(new Error("出库数量有误，应为：-"+value));
      } else {
        callback();
      }
    },
    validateAmount(rule, value, callback) {
      if (this.form.changeType === 'IN' && (value === null || value === undefined || value === '')) {
        callback(new Error("金额不能为空"));
      } else {
        callback();
      }
    },
  }
};
</script>
